import Cookies from "js-cookie";
const app = {
  state: {
    sidebar: false,
    theme: Cookies.get("theme") || "dark"
  },
  mutations: {
    TOGGLE_SIDEBAR: (state) => {
      state.sidebar = !state.sidebar;
    },
    SET_THEME: (state, theme) => {
      Cookies.set("theme", theme);
      state.theme = theme;
    }
  },
  actions: {
    toggleSideBar: ({ commit }) => {
      commit("TOGGLE_SIDEBAR");
    }
  }
};
export default app;
